<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
 <link rel="stylesheet" 
 href="<%=request.getContextPath() %>/resources/css/common/metroStyle.css" type="text/css">
 
 <script type="text/javascript" 
 src="<%=request.getContextPath() %>/resources/js/common/jquery.ztree.all.min.js"></script>
 <script type="text/javascript" 
 src="<%=request.getContextPath() %>/resources/js/back/admin.js"></script>
 <style type="text/css">
    .rmenu{position:absolute; visibility:hidden;  background-color: #555;text-align: left;padding: 2px;}
    .rmenu a{
        cursor: pointer;
        list-style: none outside none;
    }
</style>
</head>
<body>
<!-- 管理员管理弹窗 开始-->
<div class="modal fade" id="adminmodal">
	  <div class="modal-dialog">
	    <div class="modal-content">
	      <div class="modal-header">
	        <button type="button" class="close" data-dismiss="modal" ><span>&times;</span></button>
	        <h3 class="modal-title">管理员管理</h3>
	      </div>
	      <div class="modal-body">
	        	<div class="input-group">
	        		 <span class="input-group-addon">管理员名:</span>
	        		<input type="text" class="form-control"  name="name" placeholder="请输入管理员名" >
	        	</div>
	        	<input type="hidden" name=adminId>
	        	<br>
	        	<div class="input-group">
	        		 <span class="input-group-addon">密码:</span>
	        		<input type="password" class="form-control" name="password" placeholder="请输入密码">
	        	</div>
	      </div>
	      <div class="modal-footer">
	      	<button type="button" class="btn btn-primary" onclick="save_admin()">提交</button>
	        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
	      </div>
	    </div>
	  </div>
</div>
<!-- 管理员管理弹窗 结束-->

<!-- 角色管理弹窗 开始-->
<div class="modal fade" id="Rolemodal">
	  <div class="modal-dialog">
	    <div class="modal-content">
	      <div class="modal-header">
	        <button type="button" class="close" data-dismiss="modal" ><span>&times;</span></button>
	        <h3 class="modal-title">角色组管理</h3>
	      </div>
	      <div class="modal-body">
	      		<input type="hidden" name=RoleId>
	        	<div class="input-group">
	        		 <span class="input-group-addon">角色名:</span>
	        		<input type="text" class="form-control"  name="roleName" placeholder="请输入角色名" >
	        	</div>				
	      </div>
	      <div class="modal-footer">
	      	<button type="button" class="btn btn-primary" onclick="save_role()">提交</button>
	        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
	      </div>
	    </div>
	  </div>
</div>
<!-- 角色管理弹窗 结束-->

<!-- 主菜单管理弹窗 开始-->
<div class="modal fade" id="MainMenuModal">
	  <div class="modal-dialog">
	    <div class="modal-content">
	      <div class="modal-header">
	        <button type="button" class="close" data-dismiss="modal" ><span>&times;</span></button>
	        <h3 class="modal-title">主菜单管理</h3>
	      </div>
	      <div class="modal-body">
	        	<div class="input-group">
	        		 <span class="input-group-addon">主菜单名:</span>
	        		<input type="text" class="form-control"  name="MainMenuName" placeholder="请输入主菜单名" >
	        	</div>
	        	<input type="hidden" name=MainMenuId>
	      </div>
	      <div class="modal-footer">
	      	<button type="button" class="btn btn-primary" onclick="save_MainMenu()">提交</button>
	        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
	      </div>
	    </div>
	  </div>
</div>
<!-- 主菜单管理弹窗 结束-->

<!-- 子菜单管理弹窗开始 -->
<div class="modal fade" id="ChildMenuModal">
	  <div class="modal-dialog">
	    <div class="modal-content">
	      <div class="modal-header">
	        <button type="button" class="close" data-dismiss="modal" ><span>&times;</span></button>
	        <h3 class="modal-title">子菜单管理</h3>
	      </div>
	      <div class="modal-body">
	        	<div class="input-group">
	        		 <span class="input-group-addon">子菜单名:</span>
	        		<input type="text" class="form-control"  name="ChildMenuName" placeholder="请输入子菜单名" >
	        	</div>
	        	<br>
	        	<div class="input-group">
	        		 <span class="input-group-addon">URL:</span>
	        		<input type="text" class="form-control"  name="url" placeholder="请输入url" >
	        	</div>
	        	<input type="hidden" name=ChildMenuId>
	        	<input type="hidden" name=ParentMenuId> <!-- 获取父节点id -->
	      </div>
	      <div class="modal-footer">
	      	<button type="button" class="btn btn-primary" onclick="save_ChildMenu()">提交</button>
	        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
	      </div>
	    </div>
	  </div>
</div>
<!-- 子菜单管理弹窗结束 -->

	<!-- 管理员树右键菜单 -->
        <div id="adminMenu" class="rmenu" onmouseout="divout()" onmouseover="divover()">
		    <a class="list-group-item tree_top"  data-toggle="modal" data-target="#adminmodal" onclick="admininput()">新增管理员</a>
		    <a class="list-group-item tree_item" data-toggle="modal" data-target="#adminmodal" onclick="admininput()">修改管理员</a>
		    <a class="list-group-item tree_item" onclick="deleteAdmin()">删除管理员</a>
		</div>
	<!-- 角色组树右键菜单 -->
        <div id="roleMenu" class="rmenu" onmouseout="divout()" onmouseover="divover()">
		    <a class="list-group-item tree_top" data-toggle="modal" data-target="#Rolemodal" onclick="roleinput();">新增角色</a>
		    <a class="list-group-item tree_item" data-toggle="modal" data-target="#Rolemodal" onclick="roleinput();">修改角色</a>
		    <a class="list-group-item tree_item" onclick="deleteRole()">删除角色</a>
		</div>
	<!-- 菜单组树右键菜单 -->
        <div id="menuMenu" class="rmenu" onmouseout="divout()" onmouseover="divover()">
		    <a id="add_model" class="list-group-item tree_top" data-toggle="modal" data-target="#MainMenuModal" onclick="MainMenuinput('add')">新增主菜单</a>
		    <a id="edit_menu" class="list-group-item tree_top" data-toggle="modal" data-target="#ChildMenuModal" onclick="ChildMenuinput()">新增子菜单</a>
		    <a id="edit_model" class="list-group-item tree_top" data-toggle="modal" data-target="#MainMenuModal" onclick="MainMenuinput('edit')">修改主菜单</a>
		    <a id="delete_model" class="list-group-item tree_top" onclick="deleteMainMenu()">删除主菜单</a>
		    <a id="edit_menu" class="list-group-item tree_item" data-toggle="modal" data-target="#ChildMenuModal" onclick="ChildMenuinput()">修改子菜单</a>
		    <a id="delete_menu" class="list-group-item tree_item" onclick="deleteChildMenu()">删除子菜单</a>
		</div>
        
	<table class="table" style="height: 500px;">
            <tr>
                <td width="30%">
                    <ul id="admin" class="ztree" ></ul>
                </td>
                <td  width="30%">
                    <ul id="role" class="ztree" ></ul>
                </td>
                <td width="40%">
                    <ul id="menu" class="ztree" ></ul>
                </td>
            </tr>
            <tr>
                <td></td>
                <td><input type="button" class="btn btn-primary" value="分配角色组" onclick="assignGroup();"/></td>
                <td><input type="button" class="btn btn-primary" value="分配菜单" onclick="assignMenu();"/></td>
            </tr>
      </table>
      
       
</body>
</html>